package com.bbs.db.impl;

import com.bbs.db.iface.ReplyinfoDao;
import com.bbs.db.pers.Replyinfo;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * @time Nov 12, 2009, 9:24:24 PM
 * @author fdcube
 */
public class ReplyinfoImpl extends HibernateDaoSupport implements ReplyinfoDao {

    public boolean AddReply(Replyinfo value) {
        try {
            this.getHibernateTemplate().save(value);
            return true;
        } catch (DataAccessException dataAccessException) {
            logger.error(dataAccessException);
            System.out.println(dataAccessException);
            return false;
        }
    }

    public boolean DeleteReply(Replyinfo value) {
        try {
            this.getHibernateTemplate().delete(value);
            return true;
        } catch (DataAccessException dataAccessException) {
            logger.error(dataAccessException);
            return false;
        }
    }

    public List<Replyinfo> FindReplies(Replyinfo value) {
        return this.getHibernateTemplate().findByNamedParam("FROM Replyinfo AS r WHERE r.postinfo =:postinfo", "postinfo", value.getPostinfo());
    }
}
